<include file="Public:header" />
<include file="Public:leftside" />

<div class="main-content">
	<div class="breadcrumbs breadcrumbs-fixed" id="breadcrumbs">
		<ul class="breadcrumb">
			<li> <i class="icon-home home-icon"></i>
				<a href="/">首页</a>
			</li>
			<li class="active">商城商品管理</li>

		</ul>
	</div>
	<div class="page-content">
		<div class="row panel-body" style="width: 100%;margin: 5px auto;padding: 15px 0;">
			<a href="{:U('Shop/index')}" class="btn btn-sm btn-primary">商品管理</a>

		</div>
		<section class="panel-default m-b-sm">
			<div class="alert alert-info">
				<p>
					<i class="fa fa-hand-o-right m-r-xs"></i><strong>操作提示</strong>
				</p>
				<p class="alert-p m-l-xl"><i class="fa fa-caret-right m-r-xs"></i>该页面可对商品进行编辑修改操作。</p>

			</div>
		</section>

		<script type="text/javascript" src="/NewAdmin/js/jquery.uploadify.js"></script>
		<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
		<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
		<style>
			#menubar a{color: #fff;}
			#menubar.fixed{position: fixed;top: 0;z-index: 9999;margin: 0;padding: 0;width: 1149px;}
			.ajaxBrandFlag,.ajaxTicketTypeFlag{border: 1px solid #D5D5D5;display: block;float: left;width: 100%;height: 32px;}
			.ajaxBrandFlag div,.ajaxTicketTypeFlag div{float: left;margin: 0 13px 0 0;}
			.ajaxGetType .fl ul,.ajaxGetBrand .fl ul,.ajaxGetTicketType .fl ul{margin-right: 5px;}
			.goods_imgList{float: left;margin: 0;}
			.uploadify{float: left;margin: 35px 0 0 15px;}
			.uploadify-queue{display: block;float: left;width: 100%;}
			.content_title{margin: 15px 0 10px 0;line-height: 30px;font-size: 14px;font-weight: bold;color: #333;padding-left: 20px;}
			.jiage{float: left;line-height: 28px;background-color: #E6E6E6;vertical-align: top;display: inline-block;text-align: center;width: 30px;height: 30px;border: solid #D5D5D5;border-width: 1px 1px 1px 0;font-style: inherit;}
			#SKU_Style{width: 100%;float: left;min-height: 77px;line-height: 18px;overflow: hidden;background: #4cc0c1;color: #fff;}
			#SKU_Spec{background: #ffc333;color: #fff;width: 100%;float: left;min-height: 72px;line-height: 18px;}
			#SKU_Style label,#SKU_Spec label{width: 120px;white-space: nowrap;overflow: hidden;float: left;margin: 0;height: 30px;}
			.stockInput,.priceInput{width: 100px;}
			input[data-sku="SKU_Color"],input[data-sku="SKU_Spec"]{width: 150px;}
			#SKU_Spec input[type="checkbox"]{width: auto;}
			#SKU_Form{clear: both;padding: 2px 17px;background-color: #fff;}
			#SKU_Title{display: none;color: #999;}
			#SKU_Title ul{overflow: hidden;padding: 0;margin: 0;background: #fafafa;border-top: 1px #efefef solid;}
			#SKU_Title ul li{list-style: none;float: left;padding: 5px 0;font-size: 14px;text-align: center;}
			#SKU_Title ul li.title_spec{width: 166px;display: none;}
			#SKU_Title ul li.title_style{width: 200px;display: none;}
			#SKU_Title ul li.title_stock,#SKU_Title ul li.title_skuprice,#SKU_Title ul li.title_skusn{width: 100px;}
			.checkbox{background: none;}
			#SKU_Form div{margin: 10px 0;}
			#SKU_TableTD{border: 1px solid #CCC;padding: 0;width: 1007px;margin-left: 15px;}
			.SKU_Uploader_Wrap{float: left;margin: 5px 0px 0px 16px;width: 100px;text-align: center;}
			.uploaderWrap{width: 100px;height: 140px;overflow: hidden;}
			.webuploader-container{position: relative;width: 100px;float: left;}
			.uploaderWrap .webuploader-pick{height: 100px;background: url('/NewAdmin/images/image.png') no-repeat center center;border: solid 1px #dfdfdf;}
			.uploaderWrap .progress{width: 50px;height: 50px;margin: 0 auto;border-radius: 100px;background: rgba(0, 0, 0, 0.8);color: #fff;position: absolute;z-index: 1000;left: 23px;top: 32px;text-align: center;line-height: 50px;}
			.ncsc-form-radio-list{font-size: 0;*word-spacing: -1px
				/*IE6、7*/
			;}
			.ncsc-form-radio-list li{font-size: 12px;vertical-align: top;letter-spacing: normal;word-spacing: normal;display: inline-block;margin-right: 30px;}
			.ncsc-form-radio-list li{*display: inline
				/*IE6,7*/
			;}
			.ncsc-form-radio-list li label{cursor: pointer;}
			.ncsc-form-radio-list li input[type="radio"],.ncsc-form-radio-list li .radio{vertical-align: middle;margin-right: 4px;}
			.ncsc-form-radio-list li .transport-name{line-height: 20px;color: #555;background-color: #F5F5F5;display: none;height: 20px;padding: 4px;margin-right: 4px;border: dotted 1px #DCDCDC;}
			.select-template{line-height: 24px;color: #FFFFFF;background: #4AA5FF;height: 24px;padding: 0 6px;margin-left: 10px;border: solid #39F 1px;border-radius: 4px;cursor: pointer;}
			/*运费*/.transportation{width: 918px;padding: 10px 0 10px 10px;border-top: 1px solid #efefef;font-size: 14px;color: #666;font-weight: bold;}
			.transportation span{padding-right: 20px;color: #3f3f3f;}
			.transportation span strong{font-weight: normal;font-size: 12px;color: #3f3f3f;}
			.transportation b{color: #ff4f01;font-size: 16px;}
			.ncsc-form-goods dl:hover .hint{color: #666;}
			.ncsc-form-goods dl dd p{clear: both;}
			.hint{font-size: 12px;line-height: 16px;color: #BBB;margin-top: 10px;}
			.select2-search:after{content: none}
			.select2-container--default .select2-selection--single{border-radius: 0px;}
		</style>
		<link rel="stylesheet" type="text/css" href="/NewAdmin/css/uploadify.css" />
		<form action="__CONTROLLER__/save/" class="form form-horizontal" method="post">
			<input type="hidden" name="id" id="ticket_id" value="{$current.id}" />
			<input type="hidden" name="p" value="<?=I('get.p',1)?>" />
			<div class="search_box" style="overflow:hidden;background-color: #eee;margin: 0 0 5px 0;">
				<div>
					<h3 class="content_title">基本信息</h3></div>
				<div class="space-4"></div>
				<div class="form-group">
					<label class="col-sm-1 control-label no-padding-right" for="form-field-4">商品分类：</label>
					<div class="col-sm-9">

						<div class="ajaxTicketTypeFlag">
							<volist name="currentTypeArray" id="row">
								<div>
									<input type="hidden" name="type_id[]" value="{$row.id}" />
									<span>{$row.name}</span><span class="removeajax">X</span></div>
							</volist>
						</div>
						<div class="ajaxGetTicketType">
							<div class="fl">
								<ul>
									<volist name="ticketTypeArray" id="row">
										<li data="{$row.id}">{$row.name}></li>
									</volist>
								</ul>
							</div>
						</div>
					</div>
				</div>

			</div>
			<div class="search_box" style="overflow:hidden;background-color: #eee;">

				<div>
					<h3 class="content_title" id="1F">商品信息</h3></div>
				<div class="form-group">
					<label class="col-sm-1 control-label no-padding-right" for="form-field-1">*商品名称：</label>
					<div class="col-sm-7">
						<input type="text" id="form-field-1" datatype="required" data="商品名称" name="title" value="{$current['title']}" class="col-xs-10 col-sm-5" />
					</div>

					<label class="col-sm-1 control-label no-padding-right" for="form-field-1">所属店铺：</label>
					<div class="col-sm-1 " style="text-align: left;color: red;">
						<select name="store_id" disabled="">
							<option value="0">请选择所属店铺</option>
							<volist name="Storearray" id="row">
								<option value="{$row.id}" <eq name="row.id" value="$store_id"> selected="selected"</eq> >{$row.title}</option>
							</volist>
						</select>
					</div>
				</div>

				<div class="space-4"></div>
				<div class="form-group">
					<label class="col-sm-1 control-label no-padding-right" for="form-field-5">*商品品牌：</label>
					<div class="col-sm-9">
						<select name="brand_id">
							<option value="0">请选择商品品牌</option>
							<volist name="brandArray" id="row">
								<option value="{$row.id}" <eq name="row.id" value="$current['brand_id']"> selected="selected"</eq> >{$row.name}</option>
							</volist>
						</select>

					</div>
				</div>

				<div class="space-4"></div>
				<div class="form-group">
					<label class="col-sm-1 control-label no-padding-right" for="form-field-2">关键词：</label>
					<div class="col-sm-9">
						<textarea data="关键词" cols="100" name="keywords" class="form-control">{$current['keywords']}</textarea>
						<input type="button" name="" class="btn btn-primary btn-xs" id="zuzhuang" value="组装关键词" />
					</div>
				</div>

				<div class="space-4"></div>
				<div class="row">
					<div class="col-md-1" style="text-align:right;">商品描述：</div>
					<div class="col-md-9">
						<textarea rows="5" cols="100" data="商品简介" class="form-control" name="description">{$current['description']}</textarea>
					</div>
				</div>

				<div class="space-4"></div>
				<div class="form-group">
					<label class="col-sm-1 control-label no-padding-right" for="form-field-2">有效期：</label>
					<div class="col-sm-9">
						<input class="input02 input_style" name="start" onclick="laydate({istime: true,format:'YYYY-MM-DD hh:mm:ss'});" type="text" value="<?PHP echo $current['start']?date('Y-m-d H:i:s',$current['start']):date('Y-m-d H:i:s'); ?>" /> &nbsp;至&nbsp;
						<input class="input02 input_style" name="end" onclick="laydate({istime: true,format:'YYYY-MM-DD hh:mm:ss'});" type="text" value="<?PHP echo $current['end']?date('Y-m-d H:i:s',$current['end']):''; ?>" />
					</div>
				</div>

				<div class="container-fluid" style="margin-top:10px; line-height:31px;">
					<div class="row">
						<div class="col-md-1" style="text-align:right;">*原价：</div>
						<div class="col-md-2">
							<input type="number" datatype="required" data="原价" name="oprice" id="oprice" value="{$current['oprice']}" class="form-control input-sm" style="width: 52%;float: left">
							<em class="jiage">元</em>
						</div>
					</div>
				</div>
				<div class="container-fluid" style="margin-top:10px; line-height:31px;">
					<div class="row">
						<div class="col-md-1" style="text-align:right;">*市场价：</div>
						<div class="col-md-2">
							<input type="number" datatype="required" data="市场价" name="price" id="oprice" value="{$current['price']}" class="form-control input-sm" style="width: 52%;float: left">
							<em class="jiage">元</em>
						</div>
					</div>
				</div>

				<div class="container-fluid" style="margin-top:10px; line-height:31px;">
					<div class="row">
						<div class="col-md-1" style="text-align:right;">基础销量：</div>
						<div class="col-md-2">
							<input type="number" datatype="required" data="基础销量" name="sale_num" id="sale_num" value="{$current['sale_num']|default='0'}" class="form-control input-sm">
						</div>
					</div>
				</div>
				<div class="space-4"></div>
				<div class="container-fluid" style="margin-top:10px; line-height:31px;">
					<div class="row">
						<div class="col-md-1" style="text-align:right;">总库存：</div>
						<div class="col-md-2">
							<input type="number" datatype="required" data="总库存" name="num" id="num" value="{$current['num']}" class="form-control input-sm">
						</div>
					</div>
				</div>
				<div class="space-4"></div>
				<div class="container-fluid" style="margin-top:10px; line-height:31px;">
					<div class="row">
						<div class="col-md-1" style="text-align:right;">限购：</div>
						<div class="col-md-2">
							<input type="number" datatype="required" data="限购" name="xz_num" id="xz_num" value="{$current['xz_num']|default='0'}" class="form-control input-sm"> 
						</div>
						*0为不限制
					</div>
				</div>
				<div class="space-4"></div>
				<div class="container-fluid" style="margin-top:10px; line-height:31px;">
					<div class="row">
						<div class="col-md-1" style="text-align:right;">起拍量：</div>
						<div class="col-md-2">
							<input type="number" datatype="required" data="起拍量" name="qp_num" id="qp_num" value="{$current['qp_num']|default='0'}" class="form-control input-sm"> 
						</div>
						*0为不限制
					</div>
				</div>
				<div class="container-fluid" style="margin-top:10px; line-height:31px;">
					<div class="row">
						<div class="col-md-1" style="text-align:right;">排序：</div>
						<div class="col-md-2">
							<input type="text" name="px_id" value="{$current['px_id']|default=9999}" class="form-control input-sm" /> (数值越大越靠前)
						</div>
					</div>
					<div>

						<div class="space-4"></div>
						<div class="form-group">
							<label class="col-sm-1 control-label no-padding-right" for="form-field-3" id="2F">*商品图片：</label>
							<div class="col-sm-10">
								<ul id="photo_preview" class="goods_imgList">
									<?php
								if($current['gallery']){
									$gallery=explode(',',$current['gallery']);
								}else{
									$gallery="";
								}
							?>
									<volist name="gallery" id="vo">
										<?php
								if($vo==$current['image']){
									$_checked="checked=checked";
								}else{
									$_checked="";
								}
							?>
										<li class="photo_cell">
											<a class="pho" href="{$vo}" target="_blank"><img src="{$vo}" width="100" height="100"></a>
											<p>作为缩略图:
												<input type="radio" name="thumb" value="{$vo}" {$_checked}>
											</p>
											<a href="javascript:void(0);" title="删除" class="btn_del">删除</a>
										</li>
									</volist>
								</ul>
								<input type="hidden" name="gallery" id="photo_inp" value="<?=$current['gallery']?>" />
								<input type="hidden" name="image" id="image" value="<?=$current['image']?>" />
								<input id="file_upload" name="file_upload" type="file" multiple>

							</div>
						</div>
						<div><label class="col-sm-1 control-label no-padding-right" for="form-field-3" id="2F"></label>	(商品图片尺寸推荐750*750,或大于500像素的正方形图片，图片大小限制2M,建议图片不要超过500KB,以免影响前台用户体验，高质量在线图片压缩工具：https://tinypng.com/)</div>
						<div class="space-4"></div>

						<div class="row">
							<div class="col-md-1" style="text-align:right;" id="3F">商品规格：</div>
							<div class="col-md-9" id="SKU_TableTD">
								{$SKU_View}
								<div style="clear: both;"></div>
								<div id="SKU_Title">
									<ul>
										<li class="title_spec">规格</li>
										<li class="title_style">外观</li>
										<li class="title_stock">库存数量</li>
										<li class="title_skuprice">单品价格</li>
										<li class="title_skuprice">团购单价</li>
										<li class="title_skusn">SKU编号</li>
									</ul>
								</div>
								<div id="SKU_Form" data-count="0"></div>
								<div style="display: block;float: left;width: 100%;background-color: #fff;">
									<div id="SKU_Upload"></div>
								</div>
							</div>
							<a href="javascript:;" class="btn btn-primary btn-sm yanshe" style="margin-left: 10px;">更多颜色</a>
						</div>
						<div class="space-4" style="clear: both;"></div>

						<div class="row">
							<div class="col-md-1" style="text-align:right;">商品描述：</div>
							<div class="col-md-9">
								<textarea datatype="required" class="editor" rows="10" cols="80" data="商品描述" name="content">{$current['content']}</textarea>
							</div>
						</div>
						<div class="space-4"></div>
						<div class="form-group">
							<label class="col-sm-1 control-label no-padding-right" for="form-field-4">代言奖励：</label>
							<div class="col-sm-10">
								<div class="col-sm-6">
									<ul class="ncsc-form-radio-list">
										<li style="width: 20%;">

											<label  style="line-height: 17px;">
												<input name="envelope_type" class="radio" type="radio"  value="0" style="float: left;"  <eq name="current.envelope_type" value="0">checked</eq>>
												红包
											</label>
											<div nctype="div_freight" >
												<input type="text" name="redenvelope" value="{$current['redenvelope']}" class="form-control input-sm">
												<em class="add-on"><i class="icon-renminbi"></i></em>
											</div>
										</li>
										<li style="width: 20%;">
											<label style="line-height: 17px;"><input name="envelope_type"  class="radio" type="radio" value="1" style="float: left;" <eq name="current.envelope_type" value="1">checked</eq>>
												礼品
											</label>
											<div nctype="div_freight" >

													<select class="js-example-basic-single" name="envelope_product_id" style="width: 500px;height: 33px;">
															<option value="0" <eq name="current.envelope_product_id" value="0">selected</eq>>请选择产品</option>
														<foreach name="shop_list" item="v">
															<option value="{$v.id}" <eq name="current.envelope_product_id" value="$v['id']">selected</eq>>{$v.title}</option>
														</foreach>
													</select>
												<script>
                                                    $(document).ready(function() {
                                                        $('.js-example-basic-single').select2();
                                                    });
												</script>
												<div style="width: 500px;padding: 12px 0;">
												<label style="line-height: 17px;float: left;margin-right:15px">
													<input name="envelope_product_type"  class="radio" type="radio" value="0" style="float: left;" <eq name="current.envelope_product_type" value="0">checked</eq>>
													固定一户一件
												</label>
												<label style="line-height: 17px;float: left;">
													<input name="envelope_product_type"  class="radio" type="radio" value="1" style="float: left;" <eq name="current.envelope_product_type" value="1">checked</eq>>
													按推荐用户购买数
												</label>
												</div>
											</div>
										</li>
									</ul>

								</div>

							</div>
						</div>
                      
                      <div class="space-4"></div>
						<div class="form-group">
							<label class="col-sm-1 control-label no-padding-right" for="form-field-4">抵扣券：</label>
							<div class="col-sm-2">
								<input type="text" name="dikouquan" value="{$current['dikouquan']}" class="form-control input-sm">
							</div>
						</div>
						<div class="space-4"></div>
						<div class="form-group">
							<label class="col-sm-1 control-label no-padding-right" for="form-field-4">免发货：</label>
							<div class="col-sm-2">
								<label class="radio inline normal" style="line-height: 20px;">
									<input type="radio" name="mian_send" class="mian_send" value="0" <eq name="current.mian_send" value="0">checked</eq>>
									关闭
								</label>
								<label class="radio inline normal" style="line-height: 20px;">
									<input type="radio" name="mian_send" class="mian_send" value="1" <eq name="current.mian_send" value="1">checked</eq>>
									开启
								</label>

							</div>
						</div>

						<div class="space-4"></div>

						<div class="row" id="shop_config" <?php if($configArray==null){?> style="display:none";
							<?php }?>>
							<div class="col-sm-1 control-label no-padding-right" id="4F">配置属性：</div>
							<div class="col-md-9">
								<div class="configDivContent">

									<volist name="configArray" id="row">
										<div>
											<span>{$row['title']}:</span>
											<input name="config[]" type="hidden" value="<?=$row['id'].','.$row['title']?>">
											<?PHP 
													$is_write	=	$row['is_write'] == '1'?'text':'hidden';
											?>
											<input name="config{$row['id']}" id="config{$row['id']}" type="{$is_write}" value="<?=$currentConfig[$row['id']]['content']?>">
											<?PHP
													$subArray	=	explode(',',$row['content']);
													$ConfigArray	=	explode(',',$currentConfig[$row['id']]['content']);

													if( $row['content']!=' ' ){
														foreach ( $subArray AS $key=>$row1 ){
															if( !$row1 ){ continue; }
															$classFlag	=	in_array($row1,$ConfigArray)?'btn-primary':'btn-default';
															echo '<span class="btn btn-xs config'.$row['id'].' '.$classFlag.'" data="'.$row['id'].'">'.$row1.'</span> ';
														}
													}
											?>
										</div>
										<div class="space-4"></div>
									</volist>
								</div>
							</div>

						</div>
						<div class="space-4"></div>
						<div class="form-group">
							<label class="col-sm-1 control-label no-padding-right" for="form-field-4">推荐位：</label>
							<div class="col-sm-2">
								<label class="inline normal"><input type="checkbox" name="isindex"  value="1" <eq name="current.isindex" value="1">checked</eq> > 首页</label>
							</div>
						</div>
					</div>
				</div>
			</div>

			<div class="search_box" style="overflow:hidden;background-color: #eee;margin: 6px 0 5px 0;">
				<div>
					<h3 class="content_title" id="5F">商品物流信息</h3></div>
				<div class="space-4"></div>

				<div class="tuaninfo">
					<div class="space-4"></div>
					<div class="form-group">
						<label class="col-sm-1 control-label no-padding-right" for="form-field-4">运费：</label>
						<div class="col-sm-6">
							<ul class="ncsc-form-radio-list">
								<php>
									if($current['transport_id']!=null&&$current['transport_id']!=0){
										
										$moren=1;
									}else{
										
										$moren=2;
									}
								</php>
								<li>
									<input id="freight_0" nctype="freight" name="freight" class="radio" type="radio"  <eq name="moren" value="2">checked="checked"</eq> value="0">
									<label for="freight_0">固定运费</label>
									<div nctype="div_freight"  <eq name="moren" value="1">style="display: none;" </eq>>
										<input id="g_freight" class="w50 text valid" nc_type="transport" type="text" value="{$current['goods_freight']}" name="g_freight">
										<em class="add-on"><i class="icon-renminbi"></i></em>
									</div>
								</li>
								<li>
									<input id="freight_1" nctype="freight" name="freight" class="radio" type="radio" <eq name="moren" value="1">checked="checked"</eq> value="1">
									<label for="freight_1">使用运费模板</label>
									<div nctype="div_freight" <eq name="moren" value="2">style="display: none;" </eq>>
										<select name="mbrand_id">
											<option value="0">请选择模板</option>
											<foreach name="transport_list" item="v">
												<option value="{$v.id}" <eq name="current.transport_id" value="$v['id']">selected</eq>>{$v.title}</option>  
											</foreach>
										</select>
									</div>
								</li>
							</ul>
							<p class="hint">运费设置为 0 元，前台商品将显示为免运费。</p>
						</div>
					</div>

				</div>

			</div>
				
			<div class="search_box" style="overflow:hidden;background-color: #eee;margin: 6px 0 5px 0;" id="6F">
				<div class="space-4"></div>
				<div class="row">
					<div class="col-md-1" style="text-align:right;">故事标题：</div>
					<div class="col-md-9">
					<input  type="text" id="form-field-1"  data="故事标题" name="story_title" value="{$current['story_title']}" class="col-xs-10 col-sm-5" />
					</div>
				</div>
				<div class="space-4"></div>
				<div class="row">
					<div class="col-md-1" style="text-align:right;">故事封面图：</div>
					<div class="col-md-9">
						<img src="{$current['story_img']|default='/NewAdmin/images/image.png'}" style="height:75px;width:auto; margin: 0 0 6px 0px;" id="story_img">
						<input type="hidden" name="story_img" value="{$current['story_img']}" id="story_img2"/>
						<div id="uploader" style="width:200px;overflow:hidden">
								<button type="button" class="layui-btn" id="test1">
								  <i class="layui-icon">&#xe67c;</i>上传图片
								</button>
	                  	</div>
						（600*300）
					</div>
				</div>
				<div class="space-4"></div>
				<div class="row">
					<div class="col-md-1" style="text-align:right;">故事描述：</div>
					<div class="col-md-9">
						<textarea   rows="5" cols="80" data="故事描述" class="form-control" name="story_exprot" >{$current['story_exprot']}</textarea>
					</div>
				</div>
				<div class="space-4"></div>
				<div class="row">
					<div class="col-md-1" style="text-align:right;">商品故事：</div>
					<div class="col-md-9">
						<textarea   class="editor" rows="10" cols="80" data="商品故事" name="story_content" >{$current['story_content']}</textarea>
					</div>
				</div>
			</div>
			
			<div class="search_box" style="overflow:hidden;background-color: #eee;margin: 6px 0 5px 0;" id="7F">
				<div>
					<h3 class="content_title">团购设置</h3></div>
				<div class="space-4"></div>
				<div class="form-group">
					<label class="col-sm-1 control-label no-padding-right" for="form-field-4">团购设置：</label>
					<div class="col-sm-9">
						<label class="radio inline normal">
							<input type="radio" name="tuanselect" class="tuanselect" value="0" <eq name="current.tuanselect" value="0">checked</eq>> 
							关闭
						</label>
						<label class="radio inline normal">
							<input type="radio" name="tuanselect" class="tuanselect" value="1" <eq name="current.tuanselect" value="1">checked</eq>>
							开启
						</label>
					</div>
				</div>
				<div class="tuaninfo" <eq name="current.tuanselect" value="0">style="display: none"</eq>>
					<div class="space-4"></div>
					<div class="form-group">
						<label class="col-sm-1 control-label no-padding-right" for="form-field-4">开团人数：</label>
						<div class="col-sm-2">
							<input type="text" name="tuan_num" value="{$current['tuan_num']}" class="form-control input-sm">
						</div>
					</div>
					<div class="space-4"></div>
					<div class="form-group">
						<label class="col-sm-1 control-label no-padding-right" for="form-field-4">团购价格：</label>
						<div class="col-sm-2">
							<input type="text" name="tuan_price" value="{$current['tuan_price']}" class="form-control input-sm">
						</div>
					</div>
					<div class="space-4"></div>
					<div class="form-group">
						<label class="col-sm-1 control-label no-padding-right" for="form-field-4">限制购买数量：</label>
						<div class="col-sm-2">
							<input type="text" name="tuan_buynum" value="{$current['tuan_buynum']}" class="form-control input-sm">
						</div>
					</div>
					<!--<div class="space-4"></div>
					<div class="form-group">
						<label class="col-sm-1 control-label no-padding-right" for="form-field-4">团长优惠：</label>
						<div class="col-sm-2">
							<input type="text" name="tuanz_buysale" value="{$current['tuanz_buysale']}" class="form-control input-sm">
						</div>
					</div>-->
					<div class="space-4"></div>
					<div class="form-group">
						<label class="col-sm-1 control-label no-padding-right" for="form-field-4">开启时间：</label>
						<div class="col-sm-9">
							<input type="text" name="tuanz_starttime" value="<?PHP echo $current['tuanz_starttime']?date('Y-m-d H:i:s',$current['tuanz_starttime']):date('Y-m-d H:i:s'); ?>" class="input02 input_style" onclick="laydate({istime: true,format:'YYYY-MM-DD hh:mm:ss'});">至 
							<input type="text" name="tuanz_endtime" value="<?PHP echo $current['tuanz_endtime']?date('Y-m-d H:i:s',$current['tuanz_endtime']):date('Y-m-d H:i:s',strtotime("7 day")); ?>" class="input02 input_style" onclick="laydate({istime: true,format:'YYYY-MM-DD hh:mm:ss'});">
						</div>
					</div>
					<div class="space-4"></div>
				</div>
				<div class="clearfix form-actions">
					<div class="col-md-offset-3 col-md-9">
						<button class="formSubmit btn btn-primary btn-sm" id="form" value="保存" ajax="1" type="button">保存</button> &nbsp; &nbsp; &nbsp;
						<button class="btn btn-primary btn-sm btn-danger" value="取消" type="button" onclick="history.back(-1);">取消</button>
					</div>
				</div>
			</div>

		</form>

	</div>
</div>

<div id="fixedNavBar" style="display: block; right: 3%;">
	<h3>页面导航</h3>
	<ul>
		<li>
			<a href="javascript:;" data="#1F">商品信息</a>
		</li>
		<li>
			<a href="javascript:;" data="#2F">商品图片</a>
		</li>
		<li>
			<a href="javascript:;" data="#3F">商品规格</a>
		</li>
		<li>
			<a href="javascript:;" data="#4F">商品属性</a>
		</li>
		<li>
			<a href="javascript:;" data="#5F">商品物流信息</a>
		</li>
		<li><a href="javascript:;" data="#6F">商品故事</a></li>
		<li><a href="javascript:;" data="#7F">拼团管理</a></li>
	</ul>
</div>
<script>
	$("#fixedNavBar ul li a").click(function() {
		var data = $(this).attr("data");
		var scroll_offset = $(data).offset();
		var scroll = scroll_offset.top - 100;
		$("body,html").animate({
			scrollTop: scroll //让body的scrollTop等于pos的top，就实现了滚动   
		}, 500);
	});

	$(".tuanselect").click(function() {
		var tuanselect = $(this).val();
		if(tuanselect == 1) {
			$(".tuaninfo").show();
		}
		if(tuanselect == 0) {
			$(".tuaninfo").hide();
		}
	});
</script>
<script type="text/javascript">
	// 添加全局站点信息
	var BASE_URL = '/newAdmin/js/webuploader/';
	var UPLOAD_SERVER = '{:U("User/uploadify_wb")}';
	//商品SKU单品项数据
	var goods_sku = '{$current.shop_sku}';
</script>
<script type="text/javascript" src="/NewAdmin/js/webuploader/webuploader.js"></script>
<script type="text/javascript" src="/NewAdmin/js/webuploader/getting-started.js"></script>
<script type="text/javascript" src="/NewAdmin/js/Emall.js"></script>
<link rel="stylesheet" href="/NewAdmin/css/webuploader.css" />
<script>
	$(document).ready(function() {
		//SKU单品项属性选择事件监听
		Emall.SetSKUOptionListen(['#SKU_Style', '#SKU_Spec']);
		Emall.SetSKUOption(goods_sku);
		configClick();

		//修改兑换价格自动计算可兑换最大驼铃
		$('#price1').keyup(function() {
			var currentPrice = $(this).val() * 1;
			var currentPrice1 = $("#max_coin").val() * 1;
			$("#price").val(currentPrice + currentPrice1);
		});
	});
	//图片上传
	<?php $timestamp = time();?>
	$(function() {
		$('#file_upload').uploadify({
			'formData': {
				'timestamp': '<?php echo $timestamp;?>',
				'token': '<?php echo md5("unique_salt" . $timestamp);?>'
			},
			'swf': '/NewAdmin/js/uploadify.swf',
			'buttonText': '上传图片',
			'uploader': '/User/uploadify/',
			'onUploadSuccess': function(file, data, response) {
				if(/error/.test(data)) {
					html = data.replace('error', '');
				} else {
					var img_input = $("#photo_inp").val();
					var ischecked = img_input ? '' : 'checked="checked"';
					img_input = img_input ? img_input + "," + data : data;
					var img = '<img src="' + data + '" width="100" height="100">';
					var html = '<li class="photo_cell">';
					html = html + '<a class="pho" href="' + data + '" target="_blank" >';
					html += img;
					html += '</a>';
					html += '<p>作为缩略图:<input type="radio" name="thumb" ' + ischecked + '  value="' + data + '" /></p>';
					html += '<a href="javascript:void(0);" title="删除" class="btn_del">删除</a>';
					html += '</li>';
					$("#photo_inp").val(img_input);
				}

				$("#photo_preview").append(html);
				$(".btn_del").bind('click', function() {
					var index = $(this).parent().index();
					$(this).parent().remove();
					var img = $("#photo_inp").val();
					img = img.split(",");
					img.splice(index, 1);
					img = img.join(",");
					$("#photo_inp").val(img);
				});
			}
		});

		$('#file_upload0').uploadify({
			'formData': {
				'timestamp': '<?php echo $timestamp;?>',
				'token': '<?php echo md5("unique_salt" . $timestamp);?>'
			},
			'swf': '/newAdmin/js/uploadify.swf',
			'buttonText': '上传图片',
			'uploader': '/User/uploadify/',
			'onUploadSuccess': function(file, data, response) {
				if(/error/.test(data)) {
					html = data.replace('error', '');
				} else {
					var img = '<img src="' + data + '">';
					var html = '<li class="photo_cell">';
					html = html + '<a class="pho" href="' + data + '" target="_blank" >';
					html += img;
					html += '</a>';
					html += '<a href="javascript:void(0);" title="删除" class="btn_del1">删除</a>';
					html += '</li>';
					$("#tuanImage").val(data);
				}
				$("#photo_preview0").children().remove();
				$("#photo_preview0").append(html);

			}
		});
		$(".btn_del1").bind('click', function() {
			$(this).parent().remove();
			$("#tuanImage").val('');
		});
		$(".btn_del").bind('click', function() {
			var index = $(this).parent().index();
			$(this).parent().remove();
			var img = $("#photo_inp").val();
			img = img.split(",");
			img.splice(index, 1);
			img = img.join(",");
			$("#photo_inp").val(img);
		});

		$('body').delegate('.removeMeal, .removeMeal1', 'click', function() {
			$(this).parent().remove();
		});
		$('body').delegate('.addMeal', 'click', function() {
			var mealsLength = $('.meals').length;
			var mealHtml = $('#addmeal').html();
			mealHtml = mealHtml.replace(/\{flag\}/g, mealsLength);
			$(this).parent().parent().append('<div class="meals">' + mealHtml + '</div>');
		});

		$('body').delegate('.addMeal1', 'click', function() {
			var mealsLength = $(this).parent().attr('flag');
			var mealHtml = $('#addmeal1').html();
			mealHtml = mealHtml.replace(/\{flag\}/g, mealsLength);
			$(this).parent().parent().append(mealHtml);
		});

		$('body').delegate('.changePrice', 'keyup', function() {
			var currentPrice = $(this).val();
			if(currentPrice <= 10) {
				$(this).next().val(accMul(currentPrice, 0.5));
			} else if(currentPrice > 10 && currentPrice <= 50) {
				$(this).next().val(Math.floor(accMul(currentPrice, 0.3)));
			} else if(currentPrice > 50 && currentPrice <= 100) {
				$(this).next().val(Math.floor(accMul(currentPrice, 0.2)));
			} else {
				$(this).next().val(Math.floor(accMul(currentPrice, 0.1)));
			}
			$(this).next().next().val(Math.floor(accMul(currentPrice, 1.2)));
		});

		$('#zuzhuang').click(function() {
			$.get('/shop/zuzhuang', function(data) {
				layer.closeAll();

				layer.open({
					type: 1,
					skin: 'layui-layer-rim', //加上边框
					title: '组装关键词',
					area: ['800px', '400px'],
					content: data
				});
			});
		});

		// 运费部分显示隐藏
		$('input[nctype="freight"]').click(function() {
			$('input[nctype="freight"]').nextAll('div[nctype="div_freight"]').hide();
			$(this).nextAll('div[nctype="div_freight"]').show();
		});

		$('body').delegate('#zuzhuangbtn', 'click', function() {
			var zuzhuangString = '';
			$('.zuzhuangform .input-sm').each(function() {
				if($(this).val()) {
					zuzhuangString += zuzhuangString ? ',' + $(this).val() : $(this).val();
				}
			});
			$.get('/shop/zuzhuang/type/save', {
				zuzhuangString: zuzhuangString
			}, function(data) {
				var dataArray = data.split('|||');
				$('#zuzhuangcount').html(dataArray[0]);
				$('#zuzhuangend').val(dataArray[1]);
			});
		});

	});
	$(".aceaa").click(function() {
		$(".aceaa").removeAttr("checked");
		$(this).prop("checked", true)
	})
</script>

<script>
	$(function() {
		$(".totop").click(function() {
			$(document).scrollTop(0);
		})

		$(".tobottom").click(function() {
			$(document).scrollTop($("body").height());
		})
		$(".yanshe").click(function(){	
			if(!$(this).hasClass('yanskaiqi')){
				$(this).addClass('yanskaiqi');
				$("#SKU_Style").height('auto');
			}else{
				$(this).removeClass('yanskaiqi');
				$("#SKU_Style").height('60');
			}
			
		})
		var menubar = $("#menubar");
		$("#menubar  li").click(function() {
			var thisClass = $(this).attr("class");
			//alert($(document).scrollTop());
			//alert($("."+thisClass).eq(1).offset().top);
			var o = $("." + thisClass).eq(1);
			if($(document).scrollTop() < 250) {
				$(document).scrollTop(o.offset().top - 76);
			} else {
				$(document).scrollTop(o.offset().top - 38);
			}
		});
		$(document).scroll(function() {
			if($(document).scrollTop() > 250) {
				menubar.addClass("fixed");
			} else {
				menubar.removeClass("fixed");
			}
		});

	});
</script>
  <link rel="stylesheet" href="/NewAdmin/js/layui/css/layui.css" media="all">
	  <script src="/NewAdmin/js/layui/layui.js"></script>
	  <script>
		layui.use('upload', function(){
		  var upload = layui.upload;
		   
		  //执行实例
		  var uploadInst = upload.render({
			elem: '#test1' //绑定元素
			,url: '{:U("User/uploadify_wb")}' //上传接口
			,done: function(res){
				$("#story_img").attr('src',res.saveURL); 
				$("#story_img2").val(res.saveURL);
				console.log(res)
			}
			,error: function(){
			  //请求异常回调
			}
		  });
		});
		</script>
<include file="Public:footer" />